CREATE TABLE [dbo].[TblTasks]
(
[ID] [uniqueidentifier] NOT NULL,
[AdvisorStepId] [uniqueidentifier] NULL,
[ContractId] [uniqueidentifier] NULL,
[Date] [datetime] NULL,
[UserName] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[SurveyorStepId] [uniqueidentifier] NULL,
[DelayDays] [int] NULL,
[Status] [nvarchar] (max) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[IsDonei] [bit] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
ALTER TABLE [dbo].[TblTasks] WITH NOCHECK ADD
CONSTRAINT [FK_TblTasks_TblSteps] FOREIGN KEY ([AdvisorStepId]) REFERENCES [dbo].[TblStepsAdvisor] ([ID]) ON DELETE CASCADE ON UPDATE CASCADE
ALTER TABLE [dbo].[TblTasks] ADD
CONSTRAINT [FK_TblTasks_TblStepsSurveyor] FOREIGN KEY ([SurveyorStepId]) REFERENCES [dbo].[TblStepsSurveyor] ([ID]) ON DELETE CASCADE ON UPDATE CASCADE
ALTER TABLE [dbo].[TblTasks] WITH NOCHECK ADD
CONSTRAINT [FK_TblTasks_TblContract] FOREIGN KEY ([ContractId]) REFERENCES [dbo].[TblContract] ([ID]) ON DELETE CASCADE ON UPDATE CASCADE





GO
ALTER TABLE [dbo].[TblTasks] ADD CONSTRAINT [PK_TblTasks] PRIMARY KEY CLUSTERED  ([ID]) ON [PRIMARY]
GO
